<?PHP
  class RoleSelector extends Control{
    public $style = '';
    
    public function getCode(){
      $res = "<select name=\"".$this->name."\" style=\"".$this->style."\">";
      $roles = Role::getAllRoles();
      if($roles){
        foreach($roles as $role){
          if($this->value == $role->ID){
            $res .= "<option value=\"".$role->ID."\" selected=\"selected\">".htmlentities($role->name)."</option>";
          }
          else{
            $res .= "<option value=\"".$role->ID."\">".htmlentities($role->name)."</option>";
          }
        }
      }
        
      $res .= "</select>";
      return $res;
    }

  }
?>